//-----------------------------------------------------------------
// Includes
//-----------------------------------------------------------------
#include <Viewer/Referenciel.hpp>
#include <GL/gl.h>

//-----------------------------------------------------------------
// Constantes
//-----------------------------------------------------------------
#define OFFSET 0

namespace Viewer
{
	Referenciel::Referenciel( int taille ): 
	Node( OFFSET, OFFSET, OFFSET ),
	redAxe(1,0,0),
	greenAxe(0,1,0),
	blueAxe(0,0,1)
	{
		size = taille;
	}

	Referenciel::Referenciel( const Referenciel & ref ):
	Node( ref ),
	size(ref.size),
	redAxe(ref.redAxe),
	greenAxe(ref.greenAxe),
	blueAxe(ref.blueAxe)
	{
		size = ref.size;
	}

	Referenciel & Referenciel::operator=( const Referenciel & ref )
	{
		size = ref.size;
		redAxe = ref.redAxe;
		greenAxe = ref.greenAxe;
		blueAxe = ref.blueAxe;
		return *this;
	}


	Referenciel::~Referenciel()
	{

	}	

	void Referenciel::Draw()
	{
		// Axe X	
		redAxe.Draw();			
		glBegin(GL_LINES);
			glVertex3f( 0.0f, 0.0f, 0.0f );
			glVertex3f( (float)size, 0.0f, 0.0f );
		glEnd();

		// Axe Y
		greenAxe.Draw();		
		glBegin(GL_LINES);
			glVertex3f( 0.0f, 0.0f, 0.0f );
			glVertex3f( 0.0f, (float)size, 0.0f );
		glEnd();

		// Axe Z
		blueAxe.Draw();		
		glBegin(GL_LINES);
			glVertex3f( 0.0f, 0.0f, 0.0f );
			glVertex3f( 0.0f, 0.0f, (float)size );
		glEnd();
	}

	Node * Referenciel::CreateCopy()
	{
		return new Referenciel( *this );
	}
}
